/* GUI CONVERTED from bmcsrub7.i (converter v1.76) Tue Apr 23 11:41:25 2002 */
/* bmcsrub7.i - PRODUCT STRUCTURE ROLLUP (INCLUDE FILE)                       */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 9.2            CREATED: 01/31/02   BY: *P000* Samir Bavkar       */


    assign
       l_spt_cst_ll = 0
       l_spt_cst_tl = 0.

    for first spt_det
       fields (spt_cst_ll spt_cst_tl)
    no-lock
    where spt_site = p-in_gl_cost_site
    and spt_sim = csset
    and spt_part = p-in_part
    and spt_element = element : end.

    if available spt_det then
       assign
          l_spt_cst_ll = spt_cst_ll
          l_spt_cst_tl = spt_cst_tl.


     if available ptp_det then
        if ptp_pm_code = "P" /*fdn* or ptp_pm_code = "D" *fdn*/
        then l_spt_cst_ll = 0.
     if not available ptp_det then
        if pt_pm_code = "P"
        /*fdn* or pt_pm_code = "D" *fdn*/
        then l_spt_cst_ll = 0.
     if ps_ps_code <> "O" then
     cst_ll [level - 1] = cst_ll [level - 1]
        + (l_spt_cst_ll + (if (available ptp_det and not ptp_phantom)
                 or (not available ptp_det and not pt_phantom)
                 then l_spt_cst_tl else 0))
        * (ps_qty_per / (item_yield * .01))
        * (if ps_scrp_pct < 100 then (100 / (100 - ps_scrp_pct)) else 0).

     cst_ll [level] = 0.
